1. Technical Field
The present invention relates in general to an improved data processing system and in particular to a method and system for supporting dual calling conventions between different compilers. Still more particularly, the present invention relates to a method and system for supporting dual calling conventions between different compilers for methods that return structures.
2. Description of the Related Art
A "compiler" is a program that translates programs written in a high-level programming language into the native machine language of a data processing system. The input into a compiler is the "source program" or "source code" and the output is called the "object program" or "target code". Presently, in the DOS/Windows environment, no universally agreed upon calling convention exists for procedures returning structures when source code is compiled into object code. For example, most C or C++ compilers implement one of two systems for returning structures. One involves defining attributes that return pointers to structures and another entails employing a method where the caller provides a hidden argument for passing a structure back to the caller. The first is employed by Microsoft's C and C++ compiler while the second method of returning structures is employed by Borland's compiler for C and C++. Borland C and Borland C++ are available from Borland International, Inc., located in Scotts Valley, Calif. C and C++ compilers are available from Microsoft Corporation located in Redmond, Wash. As a result, between the Borland and Microsoft compilers, no binary standard exists for procedures returning structures.
For products featuring binary class libraries or binary procedure libraries, this lack of standardization can become a severe problem. Some software vendors avoid this problem by excluding methods or procedures returning structures. However, in order to facilitate the construction and distribution of language-independent class libraries that can be distributed in binary form, it is sometimes necessary to provide procedures which return structures.
Therefore, it would be advantageous to have a method and system for providing compatibility between different calling conventions found in different compilers for procedures returning structures.